<#import "/spring.ftl" as spring />
<#import "/inspector-time-macros.ftl" as imacro />
<#setting number_format="0.##"/>

<html>
<head>
	<title>Fee Calculator</title>
	<link rel="stylesheet" type="text/css" href="<@spring.url "/css/databox.css" />" />
</head>
<body>
<div id="content">
	
	<#if calculator.sequentialId?? && (calculator.sequentialId > 0)>
		<h1>INSPECTION FEE QUOTE RULE #${calculator.sequentialId}</h1>
	<#else>
		<h1>NEW INSPECTION FEE QUOTE RULE</h1>
	</#if>
	
	<@imacro.listErrors "calculator" />
	
	<form action="editBaseFeeWithAdjustersCalculatorForm.html" method="post">

	<div class="requiredText">*INDICATES REQUIRED FIELDS</div>
		
	<br style="clear-all" />

	<@spring.formHiddenInput "calculator.id" />

	<div class="databoxWrapper">
		<div class="databox">
			<h1>PROPERTY MATCHING CRITERIA</h1>
				<p>A property must match all the criteria entered below for this rule to apply.</p>
				<p>If a property does not match all then the other rules (listed on the <a href="advancedPlan.html">previous page</a>) will be consulted.</p>
				<p>If none of the rules match then the default quote price of $${calculator.inspectorCompany.baseInspectionFee} will be used.</p>
				
				<p>Leave the values blank to have this rule apply to all homes for a particular setting (say listing price, or square footage).    
				<table class="databoxLabelTable4Cols">
					<tr>
						<th>MIN PRICE</th>
						<td class="middle"><@spring.formInput "calculator.minListedPrice" /></td>
						<th>MAX PRICE</th>
						<@spring.bind "calculator.maxListedPrice" />
						<#if calculator.maxListedPrice == 0>							
							<td><input type="text" name="${spring.status.expression}" 
								value="NO LIMIT" /></td>
						<#else>
							<td><input type="text" name="${spring.status.expression}" 
								value="${spring.status.value?default("")}" /></td>							
						</#if>
					</tr>
					<tr>
						<th>MIN SQFT</th>
						<td class="middle"><@spring.formInput "calculator.minSquareFeet" /></td>
						<th>MAX SQFT</th>
						<@spring.bind "calculator.maxSquareFeet" />
						<#if calculator.maxSquareFeet == 0>							
							<td><input type="text" name="${spring.status.expression}" 
								value="NO LIMIT" /></td>
						<#else>
							<td><input type="text" name="${spring.status.expression}" 
								value="${spring.status.value?default("")}" /></td>							
						</#if>
					</tr>
					<tr>
						<th>MIN BEDROOMS</th>
						<td class="middle"><@spring.formInput "calculator.minNumberOfBedrooms", 'maxlength="1"'/></td>
						<th>MAX BEDROOMS</th>
						<@spring.bind "calculator.maxNumberOfBedrooms" />
						<#if calculator.maxNumberOfBedrooms == 0>							
							<td><input maxlength="1" type="text" name="${spring.status.expression}" 
								value="NO LIMIT" /></td>
						<#else>
							<td><input maxlength="1" type="text" name="${spring.status.expression}" 
								value="${spring.status.value?default("")}" /></td>							
						</#if>
					</tr>
					<tr>
						<th>MIN BATHROOMS</th>
						<td class="middle"><@spring.formInput "calculator.minNumberOfBathrooms", 'maxlength="3"'/></td>
						<th>MAX BATHROOMS</th>
						<@spring.bind "calculator.maxNumberOfBathrooms" />
						<#if calculator.maxNumberOfBathrooms == 0>							
							<td><input maxlength="3" type="text" name="${spring.status.expression}" 
								value="NO LIMIT" /></td>
						<#else>
							<td><input maxlength="3" type="text" name="${spring.status.expression}" 
								value="${spring.status.value?default("")}" /></td>							
						</#if>
					</tr>
					<tr>
						<th>DWELLING TYPE</th>
						<td class="middle">
							<@imacro.enumDropDown "calculator.propertyType", propertyTypes />
						</td>
						<th>FOUNDATION TYPE</th>
						<td>
							<@imacro.enumDropDown "calculator.foundationType", foundationTypes />
						</td>
					</tr>
				</table>
			</div>
	</div>

	<div class="databoxWrapper">
		<div class="databox">
			<h1>PROPERTY ZIP CODES</h1>
				<p>This rule will only apply to properties in following zip codes.</p>
				<p>If you do not specify a zip code then this rule will apply to properties in any zip code.</p>
				<table class="databoxLabelTable4Cols">
					<tr>
						<th>ZIP CODES (comma-separated)</th>
						<td class="middle"><@spring.formInput "calculator.supportedZipCodes" /></td>
					</tr>
				</table>			
		</div>
	</div>

	<div class="databoxWrapper">
		<div class="databox">
			<h1>PRICE CALCULATOR</h1>
			<p class="databoxFreeForm">BASE PRICE<span class="required">*</span> $<@spring.formInput "calculator.baseFee", 'size="6", maxlength="5"' /></p>
			<hr/>
			<p class="databoxFreeForm">OPTIONAL ADDITIONS TO BASE PRICE (for this rule only)</p>
			<p class="databoxFreeForm">Add $<@spring.formInput "calculator.perBedroomIncreaseAmount", 'size="4", maxlength="4"'/> per bedroom if the property has more than <@imacro.enumDropDown "calculator.perBedroomIncreaseLimit", perBedroomIncreaseLimitValues /> bedrooms.</p>
			<p class="databoxFreeForm">Add $<@spring.formInput "calculator.perBathroomIncreaseAmount", 'size="4", maxlength="4"'/> per bathroom if the property has more than <@imacro.enumDropDown "calculator.perBathroomIncreaseLimit", perBathroomIncreaseLimitValues /> bathrooms.</p>
			<p class="databoxFreeForm">Add $<@spring.formInput "calculator.listedPriceInThousandsIncreaseAmount", 'size="4", maxlength="4"'/> per thousand dollars if the property listing price is over <@spring.formInput "calculator.listedPriceInThousandsIncreaseLimit", 'size="4", maxlength="4"'/> thousand dollars.</p>
			<p class="databoxFreeForm">Add $<@spring.formInput "calculator.squareFeetInHundredsIncreaseAmount", 'size="4", maxlength="4"'/> per hundred square feet if the property size is over <@spring.formInput "calculator.squareFeetInHundredsIncreaseLimit", 'size="4", maxlength="4"'/> square feet.</p>
			<p class="databoxFreeForm">Add $<@spring.formInput "calculator.distanceInMilesFeeIncreasePerMile", 'size="4", maxlength="4"'/> per mile if the house is more than <@spring.formInput "calculator.distanceInMilesLimit", 'size="4"'/> miles away from zip code <@spring.formInput "calculator.distanceInMilesCenterZip", 'size="5", maxlength="5"'/>.</p> 
			<p class="databoxFreeForm">Round price additions calculated above to the nearest $<@imacro.enumDropDown "calculator.dollarsToRoundFeeAdjustmentTo", dollarRoundingValues />.</p>
		</div>
	</div>
	
	<#if calculator.inspectorCompany.pricingPlanType != "Advanced">
		<p>NOTE: Saving this rule will automatically switch from your plan from <b>${calculator.inspectorCompany.pricingPlanType}</b> to <b>Advanced</b>.</p>
	</#if>
	<input type="submit" value="SAVE" class="formButton" />
	<a href="advancedPlan.html" class="formLink">-CANCEL-</a>
	<#if calculator.id??>
		<a href="deleteFeeCalculator.html?id=${calculator.id}" class="formLink">-DELETE-</a>
	</#if>	
		
	</form>

</div>
</body>
</html>
